﻿create table dbo.Groups (
   GroupId              nvarchar(10)         collate Chinese_PRC_CI_AS not null,
   ParentGroupId        nvarchar(10)         collate Chinese_PRC_CI_AS not null,
   GroupOrder           int                  null constraint DF_UserGroups_GroupOrder default (0),
   GroupName            nvarchar(50)         collate Chinese_PRC_CI_AS not null,
   GroupDescription     nvarchar(100)        collate Chinese_PRC_CI_AS null,
   CreateBy             nvarchar(10)         collate Chinese_PRC_CI_AS null,
   CreateOn             datetime             null constraint DF_UserGroups_CreateOn default getdate(),
   ModifyBy             nvarchar(10)         collate Chinese_PRC_CI_AS null,
   ModifyOn             datetime             null,
   constraint PK_UserGroups primary key (GroupId)
         on "PRIMARY"
)
on "PRIMARY"
go

execute sp_addextendedproperty 'MS_Description', 
   '机构编号',
   'user', 'dbo', 'table', 'Groups', 'column', 'GroupId'
go

execute sp_addextendedproperty 'MS_Description', 
   '上级编号',
   'user', 'dbo', 'table', 'Groups', 'column', 'ParentGroupId'
go

execute sp_addextendedproperty 'MS_Description', 
   '机构顺序（值小靠前）',
   'user', 'dbo', 'table', 'Groups', 'column', 'GroupOrder'
go

execute sp_addextendedproperty 'MS_Description', 
   '机构名称',
   'user', 'dbo', 'table', 'Groups', 'column', 'GroupName'
go

execute sp_addextendedproperty 'MS_Description', 
   '机构描述',
   'user', 'dbo', 'table', 'Groups', 'column', 'GroupDescription'
go

execute sp_addextendedproperty 'MS_Description', 
   '创建人',
   'user', 'dbo', 'table', 'Groups', 'column', 'CreateBy'
go

execute sp_addextendedproperty 'MS_Description', 
   '创建时间',
   'user', 'dbo', 'table', 'Groups', 'column', 'CreateOn'
go

execute sp_addextendedproperty 'MS_Description', 
   '更改人',
   'user', 'dbo', 'table', 'Groups', 'column', 'ModifyBy'
go

execute sp_addextendedproperty 'MS_Description', 
   '更改时间',
   'user', 'dbo', 'table', 'Groups', 'column', 'ModifyOn'
go
